/*
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.model.events;

/**
 * <p>This is a subclass of XREEvent that represents "resource measured" events. It defines some properties specific to
 * these events. Note that values of all custom properties are actually stored in the XREEvent#params map.</p>
 *
 * <p><strong>Thread safety:</strong> This class is mutable and not thread safe.</p>
 *
 * @author saarixx, jmn
 * @version 1.0
 */
@SuppressWarnings("boxing")
public class XREResourceMeasuredEvent extends XREViewEvent {

    /**
     * <p>Represents the name of the "on resource measured" event.</p>
     *
     * <p>This is a string constant used by the user when setting the name of the event.</p>
     */
    public static final String ON_RESOURCE_MEASURED_EVENT_NAME = "onResourceMeasured";

    /**
     * <p>Represents the name used to retrieve the height parameter.</p>
     */
    private static final String HEIGHT = "height";

    /**
     * <p>Represents the name used to retrieve the width parameter.</p>
     */
    private static final String WIDTH = "width";

    private static final String X = "x";
    
    private static final String Y = "y";
    
    /**
     * <p>Creates new instance of {@link XREResourceMeasuredEvent} class.</p>
     */
    public XREResourceMeasuredEvent() {
        // empty constructor
    }

    /**
     * <p>Retrieves the width of the resource.</p>
     *
     * @return the width of the resource
     *
     * @throws IllegalStateException if the requested parameter has wrong type in the parameters map or params is null
     */
    public int getWidth() {
        return getTypedParam(WIDTH, Integer.class);
    }

    /**
     * <p>Sets the width of the resource.</p>
     *
     * @param width the width of the resource
     *
     * @throws IllegalStateException if params is null
     */
    public void setWidth(int width) {
        setParam(WIDTH, width);
    }

    /**
     * <p>Retrieves the height of the resource.</p>
     *
     * @return the height of the resource
     *
     * @throws IllegalStateException if the requested parameter has wrong type in the parameters map or params is null
     */
    public int getHeight() {
        return getTypedParam(HEIGHT, Integer.class);
    }

    /**
     * <p>Sets the height of the resource.</p>
     *
     * @param height the height of the resource
     *
     * @throws IllegalStateException if params is null
     */
    public void setHeight(int height) {
        setParam(HEIGHT, height);
    }
    
    public int getX() {
    	return getTypedParam(X, Integer.class);
    }
    
    public void setX(int x) {
        setParam(X, x);
    }
    
    public int getY() {
    	return getTypedParam(Y, Integer.class);
    }
    
    public void setY(int y) {
        setParam(Y, y);
    }
}

